package fragment.recommendfragments;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.LinearLayout;

import com.lanou.horo.myapplication.R;

import dbdao.FristDBHelper;
import fragment.AbsBaseFragment;
import utils.adapter.RecomenddbAdpter;

/**
 * Created by dllo on 15/11/30.
 */
public class RecommendDbFragment extends AbsBaseFragment {
    private RecyclerView recommedbRecylerView;
    private FristDBHelper helper;
    private RecomenddbAdpter dbadpter;
    @Override
    protected int getLayoutView() {
        return R.layout.fragment_db_recommend;
    }


    @Override
    protected void initView() {
        recommedbRecylerView = findView(R.id.recommedbRecylerView);
        helper = FristDBHelper.getInstance();
    }

    @Override
    protected void initData() {
        GridLayoutManager mana = new GridLayoutManager(getContext(), 1);
        mana.setOrientation(LinearLayout.VERTICAL);
        recommedbRecylerView.setLayoutManager(mana);
        dbadpter = new RecomenddbAdpter(getContext());
        recommedbRecylerView.setAdapter(dbadpter);
        dbadpter.addDB(helper.queryAll());

    }
}
